<?php
/**
 * User: 五哥派
 * Date: 2024/7/1
 * Tel(同WX): 17335592719
 */
namespace app\api\controller\v1;

use app\api\controller\ApiBase;
use app\api\model\dealer\Apply as ApplyModel;
use app\api\model\dealer\User as UserModel;
use app\api\service\user\User as UserService;

class Dealer extends ApiBase {


    public function getCenter(){
        // 获取当前用户ID
        $userId = UserService::getCurrentLoginUserId();

        //申请状态
        //$apply = ApplyModel::detail(['user_id' => $userId]);

        // 分销商用户信息
        $dealer = UserModel::detail(['user_id' => $userId]);// 分销商用户信息
        $isDealer = !empty($dealer);//当前用户是否为分销商
        // 推荐人昵称
        //'refereeName' => DealerUserModel::getRefereeName(),

        return success('', [
            'dealer' => $dealer,
            'isDealer' => $isDealer,
            //'apply_status' => $apply['apply_status'],
        ]);
    }

    /**
     * 分销商用户详情
     */
    public function user()
    {
        // 当前用户ID
        $userId = UserService::getCurrentLoginUserId();
        // 分销商用户详情
        $dealer = UserModel::detail(['user_id' => $userId]);
        return $this->renderSuccess(compact('dealer'));
    }


}